<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2018/12/24
 * Time: 9:36
 */

namespace app\api\model;


use think\Db;

class GameCollect
{
    public static $table = 'game_user_collect';

    /**
     * @param array $where
     * @param $page
     * @param $pageSize
     * @return false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public static function lists($where = [], $page, $pageSize)
    {
        $db = Db::name(self::$table);
        if (isset($where['user_id'])) {
            $db->where('user_id', $where['user_id']);
        }

        return $db->order('id', 'desc')->page($page, $pageSize)->select();

    }

    public static function insert($data)
    {
        return Db::name(self::$table)->insert($data);
    }
}